package com.evry.sandox.batch;

import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


public class BatchApp {

	public static void main(String[] args) throws Throwable {
		ApplicationContext appContext = new ClassPathXmlApplicationContext("batch.xml","xml-job.xml");
//		ApplicationContext appContext = new ClassPathXmlApplicationContext("batch.xml","csv-job.xml");
//		ApplicationContext appContext = new ClassPathXmlApplicationContext("batch.xml","product-xml-job.xml");
		JobLauncher jobLauncher = (JobLauncher) appContext.getBean("jobLauncher");
		Job job = (Job) appContext.getBean("importProducts");
		jobLauncher.run(job, new JobParametersBuilder().toJobParameters());
	}
	
}
